//
//  Mg_utilities.m
//  V3d_Cocoa
//
//  Created by yang liang on 11-3-23.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import	<stdio.h>
#import	<stdlib.h>
#import	<string.h>
#import	<stdarg.h>
#import	<ctype.h>
#import "Mg_utilities.h"

void *Guarded_Malloc(int size, char *routine)
{	void *p;
	
	p = malloc(size);
	if (p == NULL)
    {	fprintf(stderr,"\nError in %s:\n",routine);
		fprintf(stderr,"   Out of memory\n");
		return 0;
    }
	return (p);
}

void *Guarded_Realloc(void *p, int size, char *routine)
{	p = realloc(p,size);
	if (p == NULL)
    {	fprintf(stderr,"\nError in %s:\n",routine);
		fprintf(stderr,"   Out of memory\n");
		return 0;
    }
	return (p);
}


